package com.example.shuiyin.config;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
import lombok.extern.slf4j.Slf4j;

/**
 * @deprecated 此配置类已被MinioConfig替代，为避免Bean冲突，此类已停用
 */
// @Configuration
@RequiredArgsConstructor
@Slf4j
@Deprecated
public class MinioClientConfig {

    private final MinioProperties minioProperties;

    // @Bean
    public MinioClient minioClient() {
        if (!minioProperties.isEnabled()) {
            log.info("MinIO 存储服务已禁用");
            return null;
        }
        
        try {
            return MinioClient.builder()
                    .endpoint(minioProperties.getEndpoint())
                    .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
                    .build();
        } catch (Exception e) {
            log.error("MinIO客户端初始化失败: {}", e.getMessage(), e);
            return null;
        }
    }
} 